package com.train.trainmanage.util;

public class IntegerExtention {
	/**
	 * 
	* @Title: hasValueAndMaxZero 
	* @Description: 判断Integer是否有值且大于0
	 */
	public static boolean hasValueAndMaxZero(Integer value) {
		return (value != null && value >0);
	}

	/**
	 * 补位整形数字  如3:  左起第一位为1  后面补0 转换为"100" 然后转换成10进制数字
	 * @param val
	 * @return
	 */
	public static Integer changeInt2BinaryInt(int val){
		Integer channelId = null;
		if (IntegerExtention.hasValueAndMaxZero(val)) {
			String channelIdStr = "1";
			for (int i = 1; i < val; i++) {
				channelIdStr += "0";
			}
			channelId = Integer.valueOf(channelIdStr, 2);
		}
		return channelId;
	}
		
}
